<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="https://at.alicdn.com/t/font_2790765_pqm82v7ytg.css">
    <style>
        #demo {
            width: 200px;
            height: 200px;
            background-color: #6ff;
            margin: 50px;
        }

        form {
            margin-top: 10px;
        }

        .input-group {
            width: 300px;
            height: 40px;
            border: 1px solid #333;
            display: flex;
            align-items: centers;
            position: relative;
            border-radius: 4px;
            overflow: hidden;
        }

        .input-group label {
            width: 40px;
            height: 40px;
            text-align: center;
            /* line-height: 40px; */
            font-size: 24px;
        }

        .input-group input {
            flex: 1;
            border: 0;
            outline: none;
        }

        .input-group .yanjin {
            position: absolute;
            width: 20px;
            height: 20px;
            right: 10px;
            top: 10px;
            font-size: 18px;
        }
    </style>
</head>

<body>
    <form action="">
        <div class="input-group">
            <label for="pwd">
                <i class="iconfont icon-geren"></i>
            </label>
            <input type="password" id="pwd">
            <i class="iconfont icon-yanjing-biyan yanjin"></i>
        </div>
    </form>
</body>
<script>

    var pwdInp = document.getElementById("pwd");
    var yanjin = document.getElementsByClassName("yanjin")[0];

    yanjin.onclick = function () {
        yanjin.className = pwdInp.type == "password" ? "iconfont icon-yanjing-zhengyan yanjin" : "iconfont icon-yanjing-biyan yanjin";
        pwdInp.type = pwdInp.type == "password" ? "text" : "password";
    }



</script>

</html>